﻿@{
    ViewBag.Title = "ChargeItemTemplate";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        gridList();
    });
    function gridList() {
        var $gridList = $("#parentgridList");
        $gridList.dataGrid({
            treeGrid: true,
            url: "/HospitalizationManage/BookkeepInHos/GetChargeItemData?ks=" + keyValue,
            height: 150,
            colModel: [
                { label: "主键", name: "sfmbbh", hidden: true, key: true },
                { label: "模板代码", name: "sfmb", width: 80, align: 'left' },
                { label: '模板名称', name: 'sfmbmc', width: 100, align: 'left' },
                { label: '科室', name: 'ksmc', width: 50, align: 'left' },
            ]
        });
    }

    function btn_loaddata(rowid) {
        //yxzje = '0.00';
        //$('#yxzje').html(yxzje);
        $('#ChildgridList').jqGrid("clearGridData");
        var sfmbbh = $("#parentgridList").jqGridRowValue().sfmbbh;
        var SelectRowIndx;
        $("#ChildgridList").dataGrid({
            autoScroll: true,
            url: "/HospitalizationManage/BookkeepInHos/loadSfxmDataBySfmbbh?sfmbbh=" + sfmbbh,
            height: 200,
            colModel: [
                { label: "主键", name: "sfmbxmId", hidden: true, key: true },
                { label: '项目代码', name: 'sfxm', width: 70, align: 'left' },
                { label: '名称', name: 'sfxmmc', width: 130, align: 'left' },
                { label: '执行次数', name: 'zxcs', width: 50, align: 'left' },
                { label: '单次治疗量', name: 'zll', width: 80, align: 'left' },
                { label: '数量', name: 'sl', width: 40, align: 'left' },
                { label: '单位时长', name: 'duration', width: 50, align: 'left' },
                { label: '康复类别', name: 'kflbmc', width: 50, align: 'left' },
                { label: 'kflb', name: 'kflb', hidden: true, width: 50, align: 'left' },
                { label: '单位', name: 'dw', width: 50, align: 'left', hidden: true },
                { label: '单价', name: 'dj', width: 50, align: 'left', hidden: true },
                { label: '医保代码', name: 'ybdm', width: 100, align: 'left', hidden: true },
                { label: '费用类别', name: 'dlmc', width: 50, align: 'left' },
                { label: '规格', name: 'gg', width: 50, align: 'left', hidden: true },
                { label: '剂量', name: 'jl', width: 50, align: 'left', hidden: true },
                { label: '用法', name: 'yf', hidden: true, align: 'left' },
                { label: '频率', name: 'pl', hidden: true, align: 'left' },
                { label: '剂型', name: 'jx', hidden: true, align: 'left' },
                { label: 'dlmc', name: 'dlmc', hidden: true },
                { label: 'dl', name: 'dl', hidden: true },
                { label: 'zfxz', name: 'zfxz', hidden: true },
                { label: 'zfbl', name: 'zfbl', hidden: true },
                { label: 'dwjls', name: 'dwjls', hidden: true },
                { label: 'jjcl', name: 'jjcl', hidden: true },
                { label: 'zxks', name: 'zxks', hidden: true },
                { label: 'zxksmc', name: 'zxksmc', hidden: true },
                { label: 'yzpc', name: 'yzpc', hidden: true },
                { label: 'yzpcmc', name: 'yzpcmc', hidden: true },
                { label: 'bw', name: 'bw', hidden: true },
            ],
            multiselect: true,
            onSelectRow: function (rowid, status) {
                //var data = $("#ChildgridList").jqGrid('getRowData', rowid);
                //var xzzje = parseFloat(data.dj) * parseFloat(data.sl);
                //if (status) {
                //    yxzje = (parseFloat(yxzje) + xzzje).toFixed(2);
                //} else {
                //    yxzje = (parseFloat(yxzje) - xzzje).toFixed(2);
                //}
                //$('#yxzje').html(yxzje);
            }
        });
        var grid = $('#ChildgridList').jqGrid()[0].grid;
        $('#ChildgridList').jqGrid().setGridParam({ url: '/HospitalizationManage/BookkeepInHos/loadSfxmDataBySfmbbh?sfmbbh=' + sfmbbh });
        grid.populate();
    }


    function submitForm() {
        var rowid = $("#ChildgridList").jqGrid("getGridParam", "selarrrow");
        var obj = [];
        if (rowid != "" && rowid != undefined) {
            for (var i = 0; i < rowid.length; i++) {
                obj[i] = new Object();
                obj[i] = $('#ChildgridList').jqGrid('getRowData', rowid[i]);
            }
        }
        return obj;
    }
</script>
<div class="gridPanel">
    <table id="parentgridList"></table>
    @*<strong style="text-decoration:none;padding-left:10px;">
        已选总金额：<span style='color:red;' id="yxzje">0.00</span>元
    </strong>*@
    <table id="ChildgridList"></table>
</div>

